﻿#ifndef CD33COMM_H
#define CD33COMM_H

#include <QObject>
#include <QtSerialPort/QtSerialPort>

class CD33Comm : public QObject
{
    Q_OBJECT
public:
    explicit CD33Comm(QObject *parent = nullptr);
    bool openPort(QString port);
signals:
    double dataReceived(double mm);
public slots:
    void getData();
private slots:
    void on_readyRead();
private:
    QSerialPort * m_serialPort;
    QString m_comPort;
    int m_baudRate;
    int m_dataBits;
    int m_parity;
    int m_stopBits;

    void stateMachine(char x);
    int m_state;
    QString m_buffer;
};

#endif // CD33COMM_H
